using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace TokenManager
{
    public partial class SynchForm : Form
    {
        public bool success = false; 
        [DllImport("COTPDB.dll")]
        public static extern int OTP_DB_Sync(string user, uint firstOTP, uint nextOTP);

        public SynchForm()
        {
            InitializeComponent();
        }

        private void btnSynch_Click(object sender, EventArgs e)
        {
            int iRe = OTP_DB_Sync(txtUser.Text,uint.Parse(txtOTP1.Text),uint.Parse(txtOTP2.Text));
            if (iRe != OTPDB_DEFINE.DB_ERR_SUCCESS)
            {
                MessageBox.Show("Synchronization failed with error:" + iRe );
                success = true;
            }
            else
            {
                MessageBox.Show("Synchronization success");
                success = false;
            }
        }
    }
}